package com.lp.batch.service;

import java.io.IOException;

import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;
import org.springframework.oxm.XmlMappingException;

import com.lp.batch.domain.Taxonomies;

/**
 * This interface defines methods that are required for marshalling and
 * unmarshalling a taxonomy.xml file
 * 
 * @author Zainul Franciscus
 * 
 */
public interface TaxonomyService {

	/**
	 * @param nodeId
	 *            an atlas_node_id of a node
	 * @param xmlfile
	 *            a destination type.xml file
	 * @return the history of a destination that matches the provided node id
	 * @throws IOException
	 */
	public abstract String selectHistory(int nodeId, String xmlfile) throws IOException;

	/**
	 * @param nodeId
	 * @param xmlfile
	 * @return the history of the destination that matches the procided node id
	 * @throws IOException
	 */
	public String selectIntroduction(int nodeId, String xmlfile) throws IOException;
	
	/**
	 * @param nodeId
	 * @param xmlfile
	 * @return return a concatentation of an introduction and a history of a node
	 * @throws IOException
	 */
	public String selectIntroAndHistory(int nodeId, String xmlfile) throws IOException;
	/**
	 * Create a Taxonomies object that contains data from the provided XML file
	 * 
	 * @param xmlFile
	 *            of a Taxonomy
	 * @return a Taxonomies object
	 * @throws XmlMappingException
	 * @throws MarshalException
	 *             if Castor cannot unmarshal the taxonomies
	 * @throws ValidationException
	 * @throws IOException
	 */
	public abstract Taxonomies selectTaxonomies(String xmlfile) throws XmlMappingException, IOException;
	
	

	/**
	 * Marshall the provided taxonomies object into an XML file.
	 * 
	 * @param taxonomies
	 *            object that will be written into an XML file
	 * @param filepath
	 *            of the XML files
	 * @throws XmlMappingException
	 * @throws IOException
	 */
	public abstract void writeToXML(Taxonomies taxonomies, String filepath) throws XmlMappingException, IOException;

}